package com.guang.syncronized;

import org.openjdk.jol.info.ClassLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description 演示
 * @Author liguang
 * @Date 2022/10/19/10:36
 */
public class SyncronziedDemoOne {
    private final static Logger logger = LoggerFactory.getLogger(SyncronziedDemoOne.class);
    static Object lock  = new Object();
    public static void main(String[] args) {
        System.out.println(ClassLayout.parseInstance(lock).toPrintable());
        synchronized (lock){
            logger.info("进入到临界区代码");
            logger.info("进入到临界区代码");
            logger.info("进入到临界区代码");
        }
        synchronized (lock){
            logger.info("进入到临界区代码");
        }
    }
}
